//
// var_string.cpp for  in /home/faucon_l//Work/Tek2/maths/tmp
//
// Made by leo faucon
// Login   <faucon_l@epitech.net>
//
// Started on  Thu Mar 31 19:29:33 2011 leo faucon
// Last update Wed Jun  1 15:28:22 2011 leo faucon
//

#ifndef __CONVERT_HPP__
# define __CONVERT_HPP__

#include <sstream>
#include <iomanip>

template<typename T>
T	string_to_var(const std::string &str)
{
  T	*var = new T;
  std::istringstream s(str);
  s >> *var;
  return (*var);
}

template<typename T>
std::string	var_to_string(const T &var, int precision)
{
  std::string	str;
  std::ostringstream s;
  s << std::fixed << std::setprecision(precision) << var;
  str = s.str();
  return (str);
}

#endif
